package com.pine.dcts.task;

import com.pine.dcts.service.Task;
import com.pine.dcts.service.TaskRunnerCallback;
import lombok.Getter;

import java.util.concurrent.Callable;

/**
 * @author xiaoyuan
 * @create 2021/4/9
 **/
@Getter
public abstract class TaskRunner<T extends BaseTask> implements Callable<Boolean> {

    protected TaskRunnerCallback callback;
    protected T task;

    public TaskRunner(T task, TaskRunnerCallback callback) {
        this.task = task;
        this.callback = callback;
    }


    @Override
    public Boolean call() throws Exception {
        return execute();
    }

    public abstract Boolean  execute();
}
